import java.util.Scanner;
import java.util.Stack;

public class test17 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.next(); // 输入的字符串
        System.out.println(getResult(str));
    }

    public static int getResult(String s){
        char[] ch = s.toCharArray(); // 先转换为字符数组
        // 使用栈来进行判定
        int maxCount = 0;
        Stack<Character> stack = new Stack<>();
        for (char flag : ch){
            if(stack.isEmpty()){
                stack.push(flag);
                continue;
            }
            // 后续判定,因为要连续的,所以遇到对称的部分就要重新进行计算
            if(stack.peek().equals(flag)){
                // 出现了对称部分,要重新进行入栈
                if(maxCount < stack.size())
                    maxCount = stack.size();
                stack = new Stack<>();
                continue;
            }
            // 判定为不是对称的
            stack.push(flag);
        }
        if(maxCount < stack.size())
            maxCount = stack.size();
        return maxCount;
    }
}
